package com.chmingx.JavaBasic.exception;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

/**
 * throws抛出异常
 */
public class ThrowsException {
    public static void main(String[] args) throws Exception {
        byte[] bs = toGBK("中文");
        System.out.println(Arrays.toString(bs));
    }

    // 向上层抛出异常
    static byte[] toGBK(String s) throws UnsupportedEncodingException {
        return s.getBytes("GBK");
    }
}
